﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    Layout = null;
}
<link href="~/lib/layui/css/layui.css" rel="stylesheet" />
<script src="~/lib/layui/layui.js"></script>
<script src="~/js/js.cookie.js"></script>
<script src="~/js/moment.js"></script>
<script src="~/lib/jquery/dist/jquery.js"></script>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Demo</title>
    <!-- 请勿在项目正式环境中引用该 layui.css 地址 -->
    <link href="//unpkg.com/layui@2.9.20/dist/css/layui.css" rel="stylesheet">
</head>
<body>
    <form class="layui-form" action="">
        <div class="layui-form" lay-filter="filter-test-layer" style="margin: 16px;">
            <div class="demo-login-container">
                <div class="layui-form-item">
                    <label class="layui-form-label">物料选择</label>
                    <div class="layui-input-block">
                        <select name="interest" id="ChooseId" lay-filter="aihao">
                            <option value=0>请选择</option>
                            <option value=1>物料1</option>
                            <option value=2>物料2</option>
                            <option value=3>物料3</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">物料属性</label>
                    <div class="layui-input-block">
                        <select name="interest" id="ChooseAttribute" lay-filter="aihao">
                            <option value=0>请选择</option>
                            <option value=1>自制</option>
                            <option value=2>采购</option>
                            <option value=3>委外</option>

                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">单位</label>
                    <div class="layui-input-block">
                        <input type="text" name="username" id="Unit"  lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">规格</label>
                    <div class="layui-input-block">
                        <input type="text" name="username" id="Specification" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">bom版本</label>
                    <div class="layui-input-block">
                        <select name="interest" id="BomVersion" lay-filter="aihao">
                            <option value=0>请选择</option>
                            <option value=1>最新bom版本</option>
                            <option value=2>新版01</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">计划数量</label>
                    <div class="layui-input-block">
                        <input type="text" name="username" id="PlanCount" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">计划开始日期</label>
                    <div class="layui-input-inline layui-input-wrap">
                        <div class="layui-input-prefix">
                            <i class="layui-icon layui-icon-date"></i>
                        </div>
                        <input type="text" name="date" id="StartDateTime" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">计划结束日期</label>
                    <div class="layui-input-inline layui-input-wrap">
                        <div class="layui-input-prefix">
                            <i class="layui-icon layui-icon-date"></i>
                        </div>
                        <input type="text" name="date" id="EndDateTime" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">备注</label>
                    <div class="layui-input-block">
                        <input type="text" name="username" id="Remark" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <button class="layui-btn layui-btn-primary layui-border" onclick="layer.close(index1)">返回</button>
                    <button type="button" class="layui-btn layui-bg-blue" onclick="ProduceDetailAdd()">确定</button>
                </div>
            </div>
        </div>
    </form>
    <script>
        layui.use(['form', 'laydate', 'util'], function () {
            var form = layui.form;
            var layer = layui.layer;
            var laydate = layui.laydate;
            var util = layui.util;





            // 日期
            laydate.render({
                elem: '#StartDateTime'
            });
            // 日期
            laydate.render({
                elem: '#EndDateTime'
            });
        });


    </script>

</body>
</html>
<script>

    function ResouresList() {
        console.log(id);
        $.get({
            url: '@ViewBag.RBACWrite' + "/api/Process/ResourcesList?WorkCenterId=" + id,
            async: false,
            dataType: "json",
            contentType: "application/json",
            success: res => {
                console.log(res, "111");
                $.each(res.data, function () {
                    $("#ProcessDetailName").append(`<option value="${this.resourceId}">${this.resourceName}</option>`)
                })
            }
        })

    }
    //主生产计划资源新增
    function ProduceDetailAdd() {
        var data = {
            ChooseId: $("#ChooseId").val(),
            ChooseAttribute: $("#ChooseAttribute").val(),
            Unit: $("#Unit").val(),
            Specification: $("#Specification").val(),
            BomVersion: $("#BomVersion").val(),
            PlanCount: $("#PlanCount").val(),
            StartDateTime: $("#StartDateTime").val(),
            EndDateTime: $("#EndDateTime").val(),
            produceplanNumber: localStorage.getItem("produceplanNumber"),
            Remark: $("#Remark").val(),
        }
        $.post({
            url: '@ViewBag.RBACWrite' + "/api/produceplan/produceplanDetailAdd",
            data: JSON.stringify(data),
            async: false,
            dataType: "Json",
            contentType: "application/json",
            success: res => {
                if (res.code == 1) {
                    layer.alert("新增成功");
                    return;
                }
                else {
                    layer.alert("新增失败");
                    return;
                }
            }
        })
    }
</script>
